package com.itheima.controller.admin;


import com.itheima.dto.AdaptationParameterDTO;
import com.itheima.result.Result;
import com.itheima.service.IAdaptationParameterService;
import com.itheima.ship.po.AdaptationParameter;
import com.itheima.ship.po.Employee;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 郑哥
 * @since 2024-05-19
 *参数设置页面 增加，修改，删除
 */
@RestController
@RequestMapping("/adaptationParameter")
@Api(tags = "参数设置页面接口")
public class AdaptationParameterController {
    @Autowired
    private IAdaptationParameterService adaptationParameterService;

    @PostMapping("/add")
    @ApiOperation("增加参数标准接口")
    public Result add(@RequestBody AdaptationParameterDTO adaptationParameterDTO){
            adaptationParameterService.add(adaptationParameterDTO);
            return Result.success();
    }
    @GetMapping("selectById/{id}")
    @ApiOperation("根据id查询参数标准接口")
    public Result<AdaptationParameter> selectById(@PathVariable Long id){
        return Result.success(adaptationParameterService.getById(id));
    }

    @PutMapping("/update")
    @ApiOperation("修改参数标准接口")
    public Result update(@RequestBody AdaptationParameter adaptationParameterDTO ){
        adaptationParameterService.updateById(adaptationParameterDTO);
        return Result.success();
    }
    @DeleteMapping("/deleteById/{id}")
    @ApiOperation("根据id删除参数标准接口")
    public Result deleteById(@PathVariable Long id){
        adaptationParameterService.removeById(id);
        return Result.success();
    }
}
